import {reqbannerlist} from '../../http/api'
//状态
let state = {
    //轮播图列表
    list: []
}

//导出状态
let getters = {
    // 导出列表
    list(state) {
        return state.list
    }
}

//修改状态
let mutations = {
    // 修改列表
    changelist(state, list) {
        state.list = list
    }
}

//做逻辑 做异步
let actions = {
    // 做逻辑
    reqList({ commit }) {
        // 发请求
        reqbannerlist().then(res => {
            commit('changelist', res.data.list ? res.data.list : [])
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    //命名空间
    namespaced: true
}